<%@ page pageEncoding="UTF-8"%>

<!-- 更新商品信息框 -->
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog"
	aria-labelledby="exampleModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title" id="exampleModalLabel">更新商品信息框</h4>
			</div>

			<div class="modal-body">
				<form class="form-horizontal" id="updateForm">
					<div class="form-group">
						<label for="toselectedid" class="col-sm-2 control-label">商品编号</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="toselectedid"
								name="toselectedid" value="" readonly="readonly">
						</div>
					</div>
					<div class="form-group">
						<label for="toselectedname" class="col-sm-2 control-label">商品名称</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="toselectedname"
								name="toselectedname" value="">
						</div>
					</div>
					<div class="form-group">
						<label for="toselectedprice" class="col-sm-2 control-label">商品价格</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="toselectedprice"
								name="toselectedprice" value="">
						</div>
					</div>
					<div class="form-group">
						<label for="toselectedproduceTime" class="col-sm-2 control-label">生产日期</label>
						<div class="col-sm-10">
							<input type="text" class="form-control"
								id="toselectedproduceTime" name="toselectedproduceTime" value="">
						</div>
					</div>
					<div class="form-group">
						<label for="toselectedmadeFactory" class="col-sm-2 control-label">生产厂家</label>
						<div class="col-sm-10">
							<input type="text" class="form-control"
								id="toselectedmadeFactory" name="toselectedmadeFactory" value="">
						</div>
					</div>
				</form>
				<div class="form-group">
					<div class="col-sm-10">
						<input type="hidden" class="form-control" id="toselectedPageNum"
							name="toselectedPageNum" value="" readonly="readonly">
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" id="updateRecord">修改</button>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	$("#updateRecord").click(
			function() {
				var pn = $("#toselectedPageNum").val();
				//alert(pn);
				$.ajax({
					url : '${path}/update.action',
					type : 'post',
					data : $("#updateForm").serialize(),
					success : function(result) {
						window.location.href = '${path}/show.action?pn=' + pn
								+ '&time=' + new Date();
					}
				})
			});

	function valuesupdate(ID, name, price, produceTime, madeFactory, pageNum) {
		$("#toselectedid").val(ID);
		$("#toselectedname").val(name);
		$("#toselectedprice").val(price);
		$("#toselectedproduceTime").val(produceTime);
		$("#toselectedmadeFactory").val(madeFactory);
		$("#toselectedPageNum").val(pageNum);
	};
</script>




